/*
 * @Author: HaoyangDu@wits.com
 * @description: 
 * @param: 
 * @return: 
 */
// stores/counter.js
import { defineStore } from "pinia";
import { ref } from "vue";
export const useAppStore = defineStore("app", () => {
  // store
  const userId = ref(wx.getStorageSync("userId") || "");
  const userNo = ref(wx.getStorageSync("userNo") || "");
  const loginTime = ref(wx.getStorageSync("loginTime") || "");
  const creditId = ref(wx.getStorageSync("creditId") || "");
  const orderId = ref(wx.getStorageSync("orderId") || "");

  // action
  function setUserId(res) {
    userId.value = res;
  }
  function setLoginTime(res) {
    loginTime.value = res;
  }
  function setUserNo(res) {
    userNo.value = res;
  }
  function setCreditId(res) {
    creditId.value = res;
  }
  function setOrderId(res) {
    orderId.value = res;
  }

  return {
    userId,
    userNo,
    loginTime,
    creditId,
    orderId,
    setUserId,
    setLoginTime,
    setUserNo,
    setCreditId,
    setOrderId,
  };
});
